project(modbus)
cmake_minimum_required(VERSION 3.5.1)

message("=========${CMAKE_SYSROOT}======")
string(LENGTH "${CMAKE_SYSROOT}" len)
if(len EQUAL 0)
  set(USR_INCLUDE usr/local/include)
  link_directories(/usr/local/lib/)
else()
  set(USR_INCLUDE usr/include)
endif()

message("=========${USR_INCLUDE}======")
include_directories(
  .
  ${CMAKE_SYSROOT}/${USR_INCLUDE}/libiec61850/
  ${CMAKE_SYSROOT}/usr/include/libxml2/
)

include_directories(
  .
  modbus/
  modbus/src/
  IPC/
  IPC/socket_ipc/
  iec61850_server/
  ${CMAKE_SYSROOT}/usr/include/
)
add_definitions("-Wall -g")
add_definitions("-DDEBUG")
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/modbus)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/IPC)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/iec61850_server)